<?php 

class Email extends MY_Controller
{			
	function __construct()
	{
		parent::__construct();
		
		$CI =& get_instance();
	}
	
	function index()
	{
		$this->load->library('email');

		$this->email->from('test@insegment.com', 'Your Name');
		$this->email->to('donebes@gmail.com');
		$this->email->subject('Тест Email');
		$this->email->message('Тестирование класса отправки сообщений'); 
		$this->email->send();
		
		echo $this->email->print_debugger(); 
		
/*
		$this->CI =& get_instance();
		
		$subject = 'Тема письма';
	    $message = 'Текст письма';
	     				
		$config['mailtype'] = 'smtp';
		$config['smtp_host'] = 'mail.mirotel.net';
		$config['smtp_user'] = 'admin@spcalls.com';
		$config['smtp_pass'] = 'aabbcc';
		$config['charset'] = 'iso-8859-1';
		$config['newline'] = '\r\n';
		
		$this->CI->email->initialize($config);
		
		$this->CI->email->from('admin@spcalls.com', 'Сайт "Спонсируемые звонки"');
		$this->CI->email->to('donebes@gmail.com');				
		$this->CI->email->subject($subject);
		$this->CI->email->message($message);
	
		echo $this->CI->email->send();
		
		echo $this->CI->email->print_debugger(); */
	}
	
	function mail()
	{
		/* recipients */
		$to  = "donebes@gmail.com";
		
		/* subject */
		$subject = "Birthday Reminders for August";
		
		/* message */
		$message = '
		<html>
		<head>
		<title>Birthday Reminders for August</title>
		</head>
		<body>
		<p>Here are the birthdays upcoming in August!</p>
		<table>
		<tr>
		  <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
		</tr>
		<tr>
		  <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
		</tr>
		<tr>
		  <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
		</tr>
		</table>
		</body>
		</html>
		';
		
		/* To send HTML mail, you can set the Content-type header. */
		$headers  = "MIME-Version: 1.0\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
		
		/* additional headers */
		$headers .= "To: Oleg <donebes@gmail.com>\r\n";
		$headers .= "From: Birthday Reminder <birthday@example.com>\r\n";
		//$headers .= "Cc: birthdayarchive@example.com\r\n";
		//$headers .= "Bcc: birthdaycheck@example.com\r\n";
		
		/* and now mail it */
		mail($to, $subject, $message, $headers);
	}
	
}